home *** CD-ROM | disk | FTP | other *** search
/ Ultra Pack / UltraComputing Partner Applications.iso / SunLabs / tclTK / src / tk4.0 / tests / wm.test < prev   
Encoding:
Text File  |  1995-05-07  |  16.8 KB  |  586 lines

  1. # This file is a Tcl script to test out Tk's interactions with
  2. # the window manager, including the "wm" command.  It is organized
  3. # in the standard fashion for Tcl tests.
  4. #
  5. # Copyright (c) 1992-1994 The Regents of the University of California.
  6. # Copyright (c) 1994-1995 Sun Microsystems, Inc.
  7. #
  8. # See the file "license.terms" for information on usage and redistribution
  9. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  10. #
  11. # @(#) wm.test 1.26 95/05/06 16:48:52
  12.  
  13. if {[string compare test [info procs test]] == 1} {
  14.     source defs
  15. }
  16.  
  17. proc sleep ms {
  18.     global x
  19.     after $ms {set x 1}
  20.     tkwait variable x
  21. }
  22.  
  23. set i 1
  24. foreach geom {+20+80 +80+20 +0+0} {
  25.     catch {destroy .t}
  26.     test wm-1.$i {initial window position} {
  27.     toplevel .t -width 200 -height 150
  28.     wm geom .t $geom
  29.     update
  30.     wm geom .t
  31.     } 200x150$geom
  32.     incr i
  33. }
  34.  
  35. # The tests below are tricky because window managers don't all move
  36. # windows correctly.  Try one motion and compute the window manager's
  37. # error, then factor this error into the actual tests.  In other words,
  38. # this just makes sure that things are consistent between moves.
  39.  
  40. set i 1
  41. catch {destroy .t}
  42. toplevel .t -width 100 -height 150
  43. wm geom .t +200+200
  44. update
  45. wm geom .t +150+150
  46. update
  47. scan [wm geom .t] %dx%d+%d+%d width height x y
  48. set xerr [expr 150-$x]
  49. set yerr [expr 150-$y]
  50. foreach geom {+20+80 +80+20 +0+0 -0-0 +0-0 -0+0 -10-5 -10+5 +10-5} {
  51.     test wm-2.$i {moving window while mapped} {
  52.     wm geom .t $geom
  53.     update
  54.     scan [wm geom .t] %dx%d%1s%d%1s%d width height xsign x ysign y
  55.     format "%s%d%s%d" $xsign [expr $x$xsign$xerr] $ysign \
  56.         [expr $y$ysign$yerr]
  57.     } $geom
  58.     incr i
  59. }
  60.  
  61. set i 1
  62. foreach geom {+20+80 +80+20 +0+0 -0-0 +0-0 -0+0 -10-5 -10+5 +10-5} {
  63.     test wm-3.$i {moving window while iconified} {
  64.     wm iconify .t
  65.     sleep 200
  66.     wm geom .t $geom
  67.     update
  68.     wm deiconify .t
  69.     scan [wm geom .t] %dx%d%1s%d%1s%d width height xsign x ysign y
  70.     format "%s%d%s%d" $xsign [expr $x$xsign$xerr] $ysign \
  71.         [expr $y$ysign$yerr]
  72.     } $geom
  73.     incr i
  74. }
  75.  
  76. set i 1
  77. foreach geom {+20+80 +100+40 +0+0} {
  78.     test wm-4.$i {moving window while withdrawn} {
  79.     wm withdraw .t
  80.     sleep 200
  81.     wm geom .t $geom
  82.     update
  83.     wm deiconify .t
  84.     wm geom .t
  85.     } 100x150$geom
  86.     incr i
  87. }
  88.  
  89. if $doNonPortableTests {
  90.     test wm-5.1 {compounded state changes} {
  91.     catch {destroy .t}
  92.     toplevel .t -width 200 -height 100
  93.     wm geometry .t +100+100
  94.     update
  95.     wm withdraw .t
  96.     wm deiconify .t
  97.     list [winfo ismapped .t] [wm state .t]
  98.     } {1 normal}
  99.     test wm-5.2 {compounded state changes} {
  100.     catch {destroy .t}
  101.     toplevel .t -width 200 -height 100
  102.     wm geometry .t +100+100
  103.     update
  104.     wm withdraw .t
  105.     wm deiconify .t
  106.     wm withdraw .t
  107.     list [winfo ismapped .t] [wm state .t]
  108.     } {0 withdrawn}
  109.     test wm-5.3 {compounded state changes} {
  110.     catch {destroy .t}
  111.     toplevel .t -width 200 -height 100
  112.     wm geometry .t +100+100
  113.     update
  114.     wm iconify .t
  115.     wm deiconify .t
  116.     wm iconify .t
  117.     wm deiconify .t
  118.     list [winfo ismapped .t] [wm state .t]
  119.     } {1 normal}
  120.     test wm-5.4 {compounded state changes} {
  121.     catch {destroy .t}
  122.     toplevel .t -width 200 -height 100
  123.     wm geometry .t +100+100
  124.     update
  125.     wm iconify .t
  126.     wm deiconify .t
  127.     wm iconify .t
  128.     list [winfo ismapped .t] [wm state .t]
  129.     } {0 iconic}
  130.     test wm-5.5 {compounded state changes} {
  131.     catch {destroy .t}
  132.     toplevel .t -width 200 -height 100
  133.     wm geometry .t +100+100
  134.     update
  135.     wm iconify .t
  136.     wm withdraw .t
  137.     list [winfo ismapped .t] [wm state .t]
  138.     } {0 withdrawn}
  139.     test wm-5.6 {compounded state changes} {
  140.     catch {destroy .t}
  141.     toplevel .t -width 200 -height 100
  142.     wm geometry .t +100+100
  143.     update
  144.     wm iconify .t
  145.     wm withdraw .t
  146.     wm deiconify .t
  147.     list [winfo ismapped .t] [wm state .t]
  148.     } {1 normal}
  149.     test wm-5.7 {compounded state changes} {
  150.     catch {destroy .t}
  151.     toplevel .t -width 200 -height 100
  152.     wm geometry .t +100+100
  153.     update
  154.     wm withdraw .t
  155.     wm iconify .t
  156.     list [winfo ismapped .t] [wm state .t]
  157.     } {0 iconic}
  158. }
  159.  
  160. catch {destroy .t}
  161. toplevel .t -width 200 -height 100
  162. wm geom .t +10+10
  163. wm minsize .t 1 1
  164. update
  165. test wm-6.1 {size changes} {
  166.     .t config -width 180 -height 150
  167.     update
  168.     wm geom .t
  169. } 180x150+10+10
  170. test wm-6.2 {size changes} {
  171.     wm geom .t 250x60
  172.     .t config -width 170 -height 140
  173.     update
  174.     wm geom .t
  175. } 250x60+10+10
  176. test wm-6.3 {size changes} {
  177.     wm geom .t 250x60
  178.     .t config -width 170 -height 140
  179.     wm geom .t {}
  180.     update
  181.     wm geom .t
  182. } 170x140+10+10
  183. if $doNonPortableTests {
  184.     test wm-6.4 {size changes} {
  185.     wm minsize .t 1 1
  186.     update
  187.     puts stdout "Please resize window \"t\" with the mouse (but don't move it!),"
  188.     puts -nonewline stdout "then hit return: "
  189.     flush stdout
  190.     gets stdin
  191.     update
  192.     set width [winfo width .t]
  193.     set height [winfo height .t]
  194.     .t config -width 230 -height 110
  195.     update
  196.     incr width -[winfo width .t]
  197.     incr height -[winfo height .t]
  198.     wm geom .t {}
  199.     update
  200.     set w2 [winfo width .t]
  201.     set h2 [winfo height .t]
  202.     .t config -width 114 -height 261
  203.     update
  204.     list $width $height $w2 $h2 [wm geom .t]
  205.     } {0 0 230 110 114x261+10+10}
  206. }
  207.  
  208. test wm-7.1 {window initially withdrawn} {
  209.     catch {destroy .t}
  210.     toplevel .t -width 100 -height 30
  211.     wm geometry .t +0+0
  212.     wm withdraw .t
  213.     sleep 200
  214.     set result [winfo ismapped .t]
  215.     wm deiconify .t
  216.     list $result [winfo ismapped .t]
  217. } {0 1}
  218. test wm-7.2 {window initially withdrawn} {
  219.     catch {destroy .t}
  220.     toplevel .t -width 100 -height 30
  221.     wm geometry .t +0+0
  222.     wm withdraw .t
  223.     wm deiconify .t
  224.     sleep 200
  225.     winfo ismapped .t
  226. } 1
  227.  
  228. test wm-8.1 {window initially iconic} {
  229.     catch {destroy .t}
  230.     toplevel .t -width 100 -height 30
  231.     wm geometry .t +0+0
  232.     wm title .t 1
  233.     wm iconify .t
  234.     update idletasks
  235.     list [winfo ismapped .t] [wm state .t]
  236. } {0 iconic}
  237.  
  238. # I don't know why the wait below is needed, but without it the test
  239. # fails under twm.
  240. sleep 200
  241.  
  242. if $doNonPortableTests {
  243.     test wm-8.2 {window initially iconic} {
  244.     catch {destroy .t}
  245.     toplevel .t -width 100 -height 30
  246.     wm geometry .t +0+0
  247.     wm title .t 2
  248.     wm iconify .t
  249.     update idletasks
  250.     wm withdraw .t
  251.     wm deiconify .t
  252.     list [winfo ismapped .t] [wm state .t]
  253.     } {1 normal}
  254. }
  255.  
  256. catch {destroy .m}
  257. menu .m
  258. foreach i {{Test label} Another {Yet another} {Last label}} {
  259.     .m add command -label $i
  260. }
  261. .m post 100 200
  262. test wm-9.1 {override_redirect and Tk_MoveTopLevelWindow} {
  263.     list [winfo ismapped .m] [wm state .m] [winfo x .m] [winfo y .m]
  264. } {1 normal 100 200}
  265. .m post 150 210
  266. test wm-9.2 {override_redirect and Tk_MoveTopLevelWindow} {
  267.     list [winfo ismapped .m] [wm state .m] [winfo x .m] [winfo y .m]
  268. } {1 normal 150 210}
  269. .m unpost
  270. test wm-9.3 {override_redirect and Tk_MoveTopLevelWindow} {
  271.     list [winfo ismapped .m]
  272. } 0
  273. destroy .m
  274. catch {destroy .t}
  275.  
  276. test wm-10.1 {icon windows} {
  277.     catch {destroy .t}
  278.     catch {destroy .icon}
  279.     toplevel .t -width 100 -height 30
  280.     wm geometry .t +0+0
  281.     toplevel .icon -width 50 -height 50 -bg red
  282.     wm iconwindow .t .icon
  283.     list [catch {wm iconify .icon} msg] $msg
  284. } {1 {can't iconify .icon: it is an icon for .icon}}
  285. test wm-10.2 {icon windows} {
  286.     catch {destroy .t}
  287.     catch {destroy .icon}
  288.     toplevel .t -width 100 -height 30
  289.     wm geometry .t +0+0
  290.     toplevel .icon -width 50 -height 50 -bg red
  291.     wm iconwindow .t .icon
  292.     list [catch {wm deiconify .icon} msg] $msg
  293. } {1 {can't deiconify .icon: it is an icon for .icon}}
  294. test wm-10.3 {icon windows} {
  295.     catch {destroy .t}
  296.     catch {destroy .icon}
  297.     toplevel .t -width 100 -height 30
  298.     wm geometry .t +0+0
  299.     toplevel .icon -width 50 -height 50 -bg red
  300.     wm iconwindow .t .icon
  301.     list [catch {wm withdraw .icon} msg] $msg
  302. } {1 {can't withdraw .icon: it is an icon for .t}}
  303. test wm-10.4 {icon windows} {
  304.     catch {destroy .t}
  305.     toplevel .t -width 100 -height 30
  306.     list [catch {wm iconwindow} msg] $msg
  307. } {1 {wrong # args: should be "wm option window ?arg ...?"}}
  308. test wm-10.5 {icon windows} {
  309.     catch {destroy .t}
  310.     toplevel .t -width 100 -height 30
  311.     list [catch {wm iconwindow .t b c} msg] $msg
  312. } {1 {wrong # arguments: must be "wm iconwindow window ?pathName?"}}
  313. test wm-10.6 {icon windows} {
  314.     catch {destroy .t}
  315.     catch {destroy .icon}
  316.     toplevel .t -width 100 -height 30
  317.     wm geom .t +0+0
  318.     set result [wm iconwindow .t]
  319.     toplevel .icon -width 50 -height 50 -bg red
  320.     wm iconwindow .t .icon
  321.     lappend result [wm iconwindow .t] [wm state .icon]
  322.     wm iconwindow .t {}
  323.     lappend result [wm iconwindow .t] [wm state .icon]
  324.     update
  325.     lappend result [winfo ismapped .t] [winfo ismapped .icon]
  326.     wm iconify .t
  327.     update
  328.     lappend result [winfo ismapped .t] [winfo ismapped .icon]
  329. } {.icon icon {} withdrawn 1 0 0 0}
  330. test wm-10.7 {icon windows} {
  331.     catch {destroy .t}
  332.     toplevel .t -width 100 -height 30
  333.     list [catch {wm iconwindow .t .gorp} msg] $msg
  334. } {1 {bad window path name ".gorp"}}
  335. test wm-10.8 {icon windows} {
  336.     catch {destroy .t}
  337.     toplevel .t -width 100 -height 30
  338.     frame .t.icon -width 50 -height 50 -bg red
  339.     list [catch {wm iconwindow .t .t.icon} msg] $msg
  340. } {1 {can't use .t.icon as icon window: not at top level}}
  341. test wm-10.9 {icon windows} {
  342.     catch {destroy .t}
  343.     catch {destroy .icon}
  344.     toplevel .t -width 100 -height 30
  345.     wm geom .t +0+0
  346.     toplevel .icon -width 50 -height 50 -bg red
  347.     toplevel .icon2 -width 50 -height 50 -bg green
  348.     wm iconwindow .t .icon
  349.     set result "[wm iconwindow .t] [wm state .icon] [wm state .icon2]"
  350.     wm iconwindow .t .icon2
  351.     lappend result [wm iconwindow .t] [wm state .icon] [wm state .icon2]
  352. } {.icon icon normal .icon2 withdrawn icon}
  353. catch {destroy .icon2}
  354. test wm-10.10 {icon windows} {
  355.     catch {destroy .t}
  356.     catch {destroy .icon}
  357.     toplevel .icon -width 50 -height 50 -bg red
  358.     wm geom .icon +0+0
  359.     update
  360.     set result [winfo ismapped .icon]
  361.     toplevel .t -width 100 -height 30
  362.     wm geom .t +0+0
  363.     wm iconwindow .t .icon
  364.     after 500 {set x 1}
  365.     tkwait variable x
  366.     lappend result [winfo ismapped .t] [winfo ismapped .icon]
  367. } {1 1 0}
  368. if $doNonPortableTests {
  369.     # This test is non-portable because some window managers will
  370.     # destroy an icon window when it's associated window is destroyed.
  371.  
  372.     test wm-10.11 {icon windows} {
  373.     catch {destroy .t}
  374.     catch {destroy .icon}
  375.     toplevel .t -width 100 -height 30
  376.     toplevel .icon -width 50 -height 50 -bg red
  377.     wm geom .t +0+0
  378.     wm iconwindow .t .icon
  379.     update
  380.     set result "[wm state .icon] [winfo ismapped .t] [winfo ismapped .icon]"
  381.     destroy .t
  382.     wm geom .icon +0+0
  383.     update
  384.     lappend result [winfo ismapped .icon] [wm state .icon]
  385.     wm deiconify .icon
  386.     update
  387.     lappend result [winfo ismapped .icon] [wm state .icon]
  388.     } {icon 1 0 0 withdrawn 1 normal}
  389. }
  390.  
  391. test wm-11.1 {colormapwindows} {
  392.     catch {destroy .t}
  393.     toplevel .t -width 200 -height 200 -colormap new
  394.     wm geom .t +0+0
  395.     frame .t.a -width 100 -height 30
  396.     frame .t.b -width 100 -height 30 -colormap new
  397.     pack .t.a .t.b -side top
  398.     update
  399.     set x [wm colormapwindows .t]
  400.     frame .t.c -width 100 -height 30 -colormap new
  401.     pack .t.c -side top
  402.     update
  403.     list $x [wm colormapwindows .t]
  404. } {{.t.b .t} {.t.b .t.c .t}}
  405. test wm-11.2 {colormapwindows} {
  406.     list [catch {wm colormapwindows . 1 2} msg] $msg
  407. } {1 {wrong # arguments: must be "wm colormapwindows window ?windowList?"}}
  408. test wm-11.3 {colormapwindows} {
  409.     list [catch {wm col . "a \{"} msg] $msg
  410. } {1 {unmatched open brace in list}}
  411. test wm-11.4 {colormapwindows} {
  412.     list [catch {wm colormapwindows . foo} msg] $msg
  413. } {1 {bad window path name "foo"}}
  414. test wm-11.5 {colormapwindows} {
  415.     catch {destroy .t}
  416.     toplevel .t -width 200 -height 200 -colormap new
  417.     wm geom .t +0+0
  418.     frame .t.a -width 100 -height 30
  419.     frame .t.b -width 100 -height 30
  420.     frame .t.c -width 100 -height 30
  421.     pack .t.a .t.b .t.c -side top
  422.     wm colormapwindows .t {.t.c .t .t.a}
  423.     wm colormapwindows .t
  424. } {.t.c .t .t.a}
  425. test wm-11.6 {colormapwindows} {
  426.     catch {destroy .t}
  427.     toplevel .t -width 200 -height 200
  428.     wm geom .t +0+0
  429.     frame .t.a -width 100 -height 30
  430.     frame .t.b -width 100 -height 30
  431.     frame .t.c -width 100 -height 30
  432.     pack .t.a .t.b .t.c -side top
  433.     wm colormapwindows .t {.t.b .t.a}
  434.     wm colormapwindows .t
  435. } {.t.b .t.a}
  436. test wm-11.7 {colormapwindows} {
  437.     catch {destroy .t}
  438.     toplevel .t -width 200 -height 200 -colormap new
  439.     wm geom .t +0+0
  440.     set x [wm colormapwindows .t]
  441.     wm colormapwindows .t {}
  442.     list $x [wm colormapwindows .t]
  443. } {{} {}}
  444.  
  445. catch {destroy .t}
  446. catch {destroy .icon}
  447.  
  448. toplevel .t -width 100 -height 50
  449. wm geom .t +0+0
  450. update
  451. test wm-12.1 {Tk_WmCmd procedure, "maxsize" option} {
  452.     list [catch {wm maxsize} msg]  $msg
  453. } {1 {wrong # args: should be "wm option window ?arg ...?"}}
  454. test wm-12.2 {Tk_WmCmd procedure, "maxsize" option} {
  455.     list [catch {wm maxsize . a} msg]  $msg
  456. } {1 {wrong # arguments: must be "wm maxsize window ?width height?"}}
  457. test wm-12.3 {Tk_WmCmd procedure, "maxsize" option} {
  458.     list [catch {wm maxsize . a b c} msg]  $msg
  459. } {1 {wrong # arguments: must be "wm maxsize window ?width height?"}}
  460. if $doNonPortableTests {
  461.     test wm-12.4 {Tk_WmCmd procedure, "maxsize" option} {
  462.     wm maxsize .t
  463.     }  {1137 870}
  464. }
  465. test wm-12.5 {Tk_WmCmd procedure, "maxsize" option} {
  466.     list [catch {wm maxsize . x 100} msg]  $msg
  467. } {1 {expected integer but got "x"}}
  468. test wm-12.6 {Tk_WmCmd procedure, "maxsize" option} {
  469.     list [catch {wm maxsize . 100 bogus} msg]  $msg
  470. } {1 {expected integer but got "bogus"}}
  471. test wm-12.7 {Tk_WmCmd procedure, "maxsize" option} {
  472.     wm maxsize .t 200 150
  473.     wm maxsize .t
  474. } {200 150}
  475. if $doNonPortableTests {
  476.     # Not portable, because some window managers let applications override
  477.     # minsize and maxsize.
  478.  
  479.     test wm-12.8 {Tk_WmCmd procedure, "maxsize" option} {
  480.     wm maxsize .t 200 150
  481.     wm geom .t 300x200
  482.     update
  483.     list [winfo width .t] [winfo height .t]
  484.     } {200 150}
  485. }
  486. destroy .t
  487.  
  488. toplevel .t -width 300 -height 200
  489. wm geom .t +0+0
  490. update
  491. test wm-13.1 {Tk_WmCmd procedure, "minsize" option} {
  492.     list [catch {wm minsize} msg]  $msg
  493. } {1 {wrong # args: should be "wm option window ?arg ...?"}}
  494. test wm-13.2 {Tk_WmCmd procedure, "minsize" option} {
  495.     list [catch {wm minsize . a} msg]  $msg
  496. } {1 {wrong # arguments: must be "wm minsize window ?width height?"}}
  497. test wm-13.3 {Tk_WmCmd procedure, "minsize" option} {
  498.     list [catch {wm minsize . a b c} msg]  $msg
  499. } {1 {wrong # arguments: must be "wm minsize window ?width height?"}}
  500. test wm-13.4 {Tk_WmCmd procedure, "minsize" option} {
  501.     wm minsize .t
  502. }  {1 1}
  503. test wm-13.5 {Tk_WmCmd procedure, "minsize" option} {
  504.     list [catch {wm minsize . x 100} msg]  $msg
  505. } {1 {expected integer but got "x"}}
  506. test wm-13.6 {Tk_WmCmd procedure, "minsize" option} {
  507.     list [catch {wm minsize . 100 bogus} msg]  $msg
  508. } {1 {expected integer but got "bogus"}}
  509. test wm-13.7 {Tk_WmCmd procedure, "minsize" option} {
  510.     wm minsize .t 200 150
  511.     wm minsize .t
  512. } {200 150}
  513. if $doNonPortableTests {
  514.     # Not portable, because some window managers let applications override
  515.     # minsize and maxsize.
  516.  
  517.     test wm-13.8 {Tk_WmCmd procedure, "minsize" option} {
  518.     wm minsize .t 150 100
  519.     wm geom .t 50x50
  520.     update
  521.     list [winfo width .t] [winfo height .t]
  522.     } {150 100}
  523. }
  524. test wm-13.9 {Tk_WmCmd procedure, "resizable" option} {
  525.     list [catch {wm resizable . a} msg]  $msg
  526. } {1 {wrong # arguments: must be "wm resizable window ?width height?"}}
  527. test wm-13.10 {Tk_WmCmd procedure, "resizable" option} {
  528.     list [catch {wm resizable . a b c} msg]  $msg
  529. } {1 {wrong # arguments: must be "wm resizable window ?width height?"}}
  530. test wm-13.11 {Tk_WmCmd procedure, "resizable" option} {
  531.     list [catch {wm resizable .foo a b c} msg]  $msg
  532. } {1 {bad window path name ".foo"}}
  533. test wm-13.12 {Tk_WmCmd procedure, "resizable" option} {
  534.     list [catch {wm resizable . x 1} msg]  $msg
  535. } {1 {expected boolean value but got "x"}}
  536. test wm-13.13 {Tk_WmCmd procedure, "resizable" option} {
  537.     list [catch {wm resizable . 0 gorp} msg]  $msg
  538. } {1 {expected boolean value but got "gorp"}}
  539. test wm-13.14 {Tk_WmCmd procedure, "resizable" option} {
  540.     catch {destroy .t2}
  541.     toplevel .t2 -width 200 -height 100
  542.     wm geom .t2 +0+0
  543.     set result ""
  544.     lappend result [wm resizable .t2]
  545.     wm resizable .t2 1 0
  546.     lappend result [wm resizable .t2]
  547.     wm resizable .t2 no off
  548.     lappend result [wm resizable .t2]
  549.     wm resizable .t2 false true
  550.     lappend result [wm resizable .t2]
  551. } {{1 1} {1 0} {0 0} {0 1}}
  552. destroy .t2
  553.  
  554. test wm-14.1 {TopLevelReqProc procedure, resize causes window to move} {
  555.     catch {destroy .t}
  556.     toplevel .t -width 200 -height 200
  557.     wm geom .t +0+0
  558.     update
  559.     wm geom .t -0-0
  560.     update
  561.     set x [winfo x .t]
  562.     set y [winfo y .t]
  563.     .t configure -width 300 -height 150
  564.     update
  565.     list [expr [winfo x .t] - $x] [expr [winfo y .t] - $y] \
  566.         [winfo width .t] [winfo height .t]
  567. } {-100 50 300 150}
  568.  
  569. test wm-15.1 {ParseGeometry procedure, resize causes window to move} {
  570.     catch {destroy .t}
  571.     toplevel .t -width 200 -height 200
  572.     wm geom .t +0+0
  573.     update
  574.     wm geom .t -0-0
  575.     update
  576.     set x [winfo x .t]
  577.     set y [winfo y .t]
  578.     wm geometry .t 150x300
  579.     update
  580.     list [expr [winfo x .t] - $x] [expr [winfo y .t] - $y] \
  581.         [winfo width .t] [winfo height .t]
  582. } {50 -100 150 300}
  583.  
  584. catch {destroy .t}
  585. concat {}
  586.